;
layui.define(['table', 'form'], function (exports) {
    var $ = layui.$,
        table = layui.table,
        form = layui.form;

    table.render({
        elem: '#historyVersionTable'
        , url: '/historyVersion/fileVersionList' //模拟接口
        , cols: [[
            {field: 'id', hide: true, title: 'ID'},
            , {field: 'app_key', width: 274, title: 'app_key'}
            , {field: 'version_f', title: '文件版本', width: 100}
            , {field: 'base_line_md5', title: '基线md5', width: 200}
            , {field: 'config_md5', title: '配置md5', width: 200}
            , {field: 'featrue_md5', title: '特征md5', width: 100}
            , {field: 'fn_ip', title: 'fn的ip', width: 100}
            , {field: 'create_time', title: '创建时间', width: 100}
            , {field: 'version', title: 'version', width: 100}
            , {
                field: 'active', title: '是否生效', width: 100, templet: (d) => {
                    if (d.active == '0') {
                        return '否';
                    }
                    if (d.active == '1') {
                        return '是';
                    } else {
                        return '异常状态';
                    }
                }
            }
            , {title: '操作', width: 220, align: 'center', fixed: 'right', toolbar: '#historyBar'}
        ]]
        , page: true
        , limit: 30
        , height: 'full-220'
        , text: {
            none: '暂无相关数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
        }
    });

    //监听搜索
    form.on('submit(LAY-user-front-search)', function (data) {
        var field = data.field;
        //执行重载
        table.reload('historyVersionTable', {
            where: field
        });
    });

    //对外输出
    exports('fileVersionList', {});
});
